<?php namespace Cribbb\Service\Validation;
 
abstract class ValidatorAbstract {
	
	/**
	 * Validator
	 * @var object instance of the specific validation class that will be performing the validation tests.
	 */
	protected $validator;
	
	/**
	 * Data to be validated
	 * @var array raw data that we pass into the validator to see if it passes our validation rules.
	 */
	protected $data = array();
	
	/**
	 * Validation Rules
	 * @var array rules of the validation as an array of attributes.
	 */
	protected $rules = array();
	
	/**
	 * Validation errors
	 * @var array if the validator class returns any errors they will be stored in this property
	 */
	protected $errors = array();
	
	/**
	 * Set data to validate
	 *
	 * @param array $data
	 * @return self
	 */
	public function with(array $data)
	{
		$this->data = $data;
	
		return $this;
	}
	
	/**
	 * Return errors
	 *
	 * @return array
	 */
	public function errors()
	{
		return $this->errors;
	}
	
	/**
	 * Pass the data and the rules to the validator
	 *
	 * @return boolean
	 */
	abstract function passes();
}